﻿using System;
using System.Collections.Generic;
using System.Web;
using Microsoft.SharePoint;

namespace CKS.SharePoint.Workbook {
    public class WebPartPageBase : Microsoft.SharePoint.WebPartPages.WebPartPage {
        protected override void OnPreInit(EventArgs e) {
            System.Diagnostics.Trace.WriteLine("WebPartPageBase.OnPreInit called");
            base.OnPreInit(e);

            SPWeb site = SPContext.Current.Web;

            SPSecurity.RunWithElevatedPrivileges(delegate() {
                using (SPSite siteColletion = new SPSite(site.Site.ID)) {
                    using (SPWeb fullControlSite = siteColletion.AllWebs[site.ID]) {
                        this.MasterPageFile = fullControlSite.MasterUrl;
                    }
                }
            });
        }
    }
}
